package com.novacloud.controller;

import com.novacloud.core.BaseController;
import com.novacloud.core.Result;
import com.novacloud.domain.TUser;
import com.novacloud.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author <a href="mailto:huzhanjun@novacloud.com">huzj</a>
 * @version 1.0
 * @date 2017/9/22 10:18
 */
@Api(value = "用户模块")
@RestController
@RequestMapping("/api/user")
public class UserController extends BaseController{
    @Autowired
    private UserService userService;

    @ApiOperation(value = "获取所有用户信息")
    @GetMapping(value = "")
    public Result findAll() {
        return resultSuccess(userService.findAll());
    }

    @ApiOperation(value = "插入新的用户信息")
    @PostMapping()
    public Result add(TUser tUser) {
        userService.add(tUser);
        return resultSuccess(tUser);
    }
}
